export const betweenWith = (interval, number) => {
  const [min, max] = interval;

  return number >= min && number <= max;
}

export const betweenWithLeft = (interval, number) => {
  const [min, max] = interval;

  return betweenWith(interval, number) && number !== max;
}

export const intersectWith = (interval1, interval2) => {
  const [min, max] = interval1;
  const [start, end] = interval2;

  return (start >= min && start <= max)
    || (end >= min && end <= max);
}

export const betweenWithIn = (interval1, interval2) => {
  const [min, max] = interval1;
  const [start, end] = interval2;

  return (start <= min && end >= max)
    || (min <= start && max >= end);
}